package com.emr.web.controller.emr;

import java.util.List;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.emr.common.annotation.Log;
import com.emr.common.base.AjaxResult;
import com.emr.common.enums.BusinessType;
import com.emr.framework.web.page.TableDataInfo;
import com.emr.module.domain.Personal;
import com.emr.module.service.IChuanRanService;
import com.emr.web.core.base.BaseController;

/**
 * 个人病例 信息操作处理
 * 
 * @author emr
 * @date 2019-02-19
 */
@Controller
@RequestMapping("/module/chuanran")
public class ChuanRanController extends BaseController
{
    private String prefix = "module/chuanran";
	
	@Autowired
	private IChuanRanService chuanranService;

	
	@RequiresPermissions("module:chuanran:view")
	@GetMapping()
	public String chuanran()
	{
	    return prefix + "/chuanran";
	}
	
	/**
	 * 查询个人病例列表
	 */
	@RequiresPermissions("module:chuanran:list")
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(Personal personal)
	{
		startPage();
        List<Personal> list = chuanranService.selectChuanranList(personal);
		return getDataTable(list);
	}
	
	@RequiresPermissions("module:chuanran:remove")
	@Log(title = "个人病例", businessType = BusinessType.DELETE)
	@PostMapping( "/remove")
	@ResponseBody
	public AjaxResult remove(Integer ids)
	{		
		Personal personal = chuanranService.selectChuanranById(ids);
		personal.setPatientYesOnNo("是");
		return toAjax(chuanranService.updateChuanran(personal));
	}

}
